﻿using UnityEngine;
using System.Collections;

public class BasicLandEnemy : BaseEnemy
{
	protected override void Attack()
	{
		Vector3 playerGround = new Vector3 (player.position.x, 1, player.position.z);
		transform.LookAt (playerGround);
		
		if(canShoot)
		{
			Vector3 playerDir = (playerGround - transform.position).normalized;
			GameObject bullet = poolManager.GetFromPool (myBulletPool);
			if(bullet)
				bullet.GetComponent<BaseBulletScript>().Shoot(transform.position + playerDir, Quaternion.LookRotation(playerDir));
			canShoot = false;
		}
	}

}
